< previous page page_287 next page >

Page 287
F=5
D=5
C=5
B=5
V=5
S =5
The difference is that, in each case, Visual Basic stores that number in a different way. The truth is that, as a Visual Basic programmer, you may not even care which type of variable you use. Some so-called Visual Basic "experts" actually encourage people to always use variants so that they never have to worry about the type of variable they are using!
Personally, I consider this approach to be fundamentally silly. It's inefficient, harder to support in the long run, and more prone to bugs. But in many cases, it will work.
However, if you plan to call API or DLL functions from Visual Basic, ignorance of variable types and how they work will ultimately prevent you from doing more than blindly copying other people's declarations and hoping not only that the declarations are correct, but also that they are appropriate to your particular application.
We'll look at these different variable types later. First, let's take a look at the true purpose of variables.
The Inner Life of Variables
The purpose of a variable is to store data. Data is stored in memory.
But what, exactly, is memory?
When you go to your local electronics store, memory means a funny little PC card with some tiny chips on it that you can't believe costs $50, but you're grateful (because you know that it cost twice that last week) and frustrated (because you know it will cost half that next week).
You know that your system has 16MB or 32MB or 64MB or so of memory, but you may not be sure what a MB is (it's a megabyte, meaning a million bytes of dataonly it's not a million bytes, it's 1,048,576 bytesbut who cares, since you're not sure what a byte is anyway?).
So I want you to forget all that. How much memory your system has may affect performance, but it means nothing to you as a VB programmer.
What you do need to know starts with a fundamental building block called a bit.

 
< previous page page_287 next page >